package com.study.service;

import com.study.mapper.BusReceiverMapper;
import com.study.entity.BusReceiverEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

@Service
public class BusReceiverServiceImpl implements BusReceiverService<BusReceiverEntity> {

    @Resource
    BusReceiverMapper busReceiverMapper;

    @Override
    public  BusReceiverEntity findById(Integer id) {
        // receiverDao.findById(id);
        return busReceiverMapper.findById(id);
    }

    @Override
    public  void delete(Integer id) {
        busReceiverMapper.delete(id);
    }

    @Override
    public void insert(BusReceiverEntity busReceiverEntity) {
        busReceiverMapper.insert(busReceiverEntity);
    }

    public List<BusReceiverEntity> findList(String name, String address){
        return busReceiverMapper.findList(name, address);
    }

    @Override
    public List<BusReceiverEntity> findAll() {
        return busReceiverMapper.findAll();
    }

    @Override
    public List<BusReceiverEntity> findListByPage(Integer currPage, Integer pageSize) {
        HashMap<String, Integer> map = new HashMap<>();
        map.put("currPage", currPage);
        map.put("pageSize", pageSize);
        return busReceiverMapper.findListByPage(map);
    }
}